package com.boarsoft.message.test.other;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.boarsoft.common.util.JsonUtil;
import com.boarsoft.message.bean.Message;
import com.boarsoft.message.core.MessageSender;
import com.boarsoft.message.core.MessageService;
import com.boarsoft.message.core.Messenger;

/**
 * 用于发送消息并接收收件人签收通知的类<br/>
 * 实现MessageService是为了接收签收消息，而不是发送
 * 
 * @author Mac_J
 *
 */
@Component("queue1Producer1")
public class Queue1Producer1 implements MessageService, MessageSender {
	private static final Logger log = LoggerFactory.getLogger(Queue1Producer1.class);

	@Override
	public void put(Message m) throws Exception {
		log.info("Received acknowledge: {}", JsonUtil.from(m));
	}

	@Override
	public void send(Message m) throws Exception {
		Messenger.send(m);
	}
}